package logic

import (
	"context"
	"hosp/models"

	"hosp/hosprpc/hosprpc"
	"hosp/hosprpc/internal/svc"

	"github.com/zeromicro/go-zero/core/logx"
)

type PatientDelLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewPatientDelLogic(ctx context.Context, svcCtx *svc.ServiceContext) *PatientDelLogic {
	return &PatientDelLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

// 删除
func (l *PatientDelLogic) PatientDel(in *hosprpc.PatientDelRequest) (*hosprpc.PatientDelResponse, error) {
	// todo: add your logic here and delete this line

	var patient models.Patient

	err := patient.PatientDel(models.DB, in.PatientId)
	if err != nil {
		return nil, err
	}

	return &hosprpc.PatientDelResponse{}, nil
}
